<?php
	require_once($_SERVER['DOCUMENT_ROOT'].'uno-course-scheduler/include/config.inc.php');
	require_once($_SERVER['DOCUMENT_ROOT'].'uno-course-scheduler/include/top.inc.php');
?>

<h1>Edit Building</h1>

<?php

$building_id = mysql_real_escape_string(strip_tags($_POST['id']));
$building_name = mysql_real_escape_string(strip_tags($_POST['name']));
$abbreviation = mysql_real_escape_string(strip_tags($_POST['abbrev']));

//select statement
$query="UPDATE buildings 
SET building_name='$building_name', abbreviation='$abbreviation'
WHERE id='$building_id'";

$result=mysql_query($query);

//close
mysql_close();

if ($result)
{
	echo "<b>".stripslashes($building_name)."</b> has been successfully updated!";
	echo "<br />";
}
else
{
	echo "<b>".stripslashes($building_name)."</b> was NOT able to be updated at this time!";
	echo "<br />";
}


?>

<p>
	<a href="index.php">&lt;&lt; Back to Buildings Portal</a><br />
</p>

<?php
	require_once($_SERVER['DOCUMENT_ROOT'].'uno-course-scheduler/include/bottom.inc.php');
?>